﻿using DavidCms.Web.Models;
using MvcSiteMapProvider;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace DavidCms.Web
{
    public class ListDetailDynamicNodeProvider:DynamicNodeProviderBase
    {
        public override IEnumerable<DynamicNode> GetDynamicNodeCollection(ISiteMapNode node)
        {
            CmsContext db = new CmsContext();
            foreach (var article in db.Article)
            {
                DynamicNode nodes = new DynamicNode();
                node.Title = article.Title;
                node.RouteValues.Add("Id", article.Id);
                yield return nodes;
            }
        }
    }
}